package com.crimerank.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.google.android.maps.GeoPoint;

public class Stop implements Serializable {

	private static final long serialVersionUID = 3984131684156458763L;
	private int gid;
	private String name;
	private String stop_id;
	private String location;
	private List<String> routes = new ArrayList<String>();
	
	public void setGid(int gid) {
		this.gid = gid;
	}

	public int getGid() {
		return gid;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setStop_id(String stop_id) {
		this.stop_id = stop_id;
	}

	public String getStop_id() {
		return stop_id;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public GeoPoint getLocation() {
		GeoPoint loc;
		
		String[] lonLat = location.replaceFirst("POINT\\(", "")
		.replace(")", "").split(" ");
		Double lon = Double.parseDouble(lonLat[0]) * 1000000;
		Double lat = Double.parseDouble(lonLat[1]) * 1000000;
		loc = new GeoPoint(lat.intValue(), lon.intValue());
		
		return loc;
	}

	public void setRoutes(List<String> routes) {
		this.routes = routes;
	}

	public List<String> getRoutes() {
		return routes;
	}

	public void addRoute(String route) {
		routes.add(route);
	}
}
